﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SdmxMl.Multiplexor;

namespace SdmxMl.Panels
{
    public partial class DlgSubscription : Form
    {
        public DlgSubscription()
        {
            InitializeComponent();

            this.ucSubscriptionsEditor.LoadSubscriptions(Mux.Instance.GetNotificationRegistry().GetSubscriptions());
        }

        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                Mux.Instance.GetNotificationRegistry().UpdateSubscriptions(this.ucSubscriptionsEditor.GetSubscriptions());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
       }

        private void resetToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                this.ucSubscriptionsEditor.LoadSubscriptions(Mux.Instance.GetNotificationRegistry().GetSubscriptions());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

        }
    }
}
